package FirstWeek;

import Basic.IO;

import java.util.*;

public class Forth {
    public static void res(){
        String str;
        str = IO.inputString("请输入一个字符串");

        char[] ca = str.toCharArray();
        List<Character> temp = new ArrayList<Character>();
        List<Integer> count = new ArrayList<Integer>();
//        System.out.println(str);

        for(int i = 0; i < str.length(); i++){
            Character c = ca[i];
            if(temp.contains(c)){
                count.set(temp.indexOf(c),count.get(temp.indexOf(c))+1);
            }else{
                temp.add(c);
                count.add(1);
            }
        }

        for(int i = 0; i < temp.size(); i++){
            System.out.println(temp.get(i) + "出现的次数为：" + count.get(i));
        }
    }
}
